//
//  DrawRectPorgressViewController.m
//  ObjectiveCTools
//
//  Created by aidong on 2022/1/6.
//  Copyright © 2022 姬友大人. All rights reserved.
//

#import "DrawRectPorgressViewController.h"
#import "DRProgressJuxingView.h"
#import "DRProgressHuanxingView.h"

@interface DrawRectPorgressViewController ()

@property (nonatomic) NSInteger p;

@property (nonatomic, strong) DRProgressJuxingView *juxing;

@property (nonatomic, strong) DRProgressHuanxingView *huanxing;



@end

@implementation DrawRectPorgressViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = UIColor.whiteColor;
    
    self.juxing = [[DRProgressJuxingView alloc] initWithFrame:CGRectMake(50, 200, 250, 60)];
    [self.view addSubview:self.juxing];

    //TODO: 没有解决重复绘制的 bug...
    self.huanxing = [[DRProgressHuanxingView alloc] initWithFrame:CGRectMake(100, 400, 100, 100)];
    [self.view addSubview:self.huanxing];

    [self performSelector:@selector(goprogress) withObject:nil afterDelay:0.02];
}


- (void)goprogress {
    self.p += 1;

    self.juxing.progress = self.p * 0.01;
    self.huanxing.progress = self.p * 0.01;

    if (self.p == 100) {
        self.p = 0;
    }
    [self performSelector:@selector(goprogress) withObject:nil afterDelay:0.02];
}

@end
